<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>BOM明细编辑</title>
	<!-- import css and js --> 
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/yd/logic/freigHtageTypeData.js"></script>
<script type="text/javascript">
var basic_Url="${ctx}/yd/basic/bom";
var grid;
// var ItemStateList = freigHtageTypeData.Rows;
$(function(){
	
// 	 $("#kdgs").change(function(){ 
// 			$("#creategsname").val($("#kdgs").find("option:selected").text());
// 			$("#creategscode").val($("#kdgs").val());
// 		}); 
	 
	
	var griddata ={};
	grid = $("#table1").ligerGrid({
        columns: [
				  { display: 'componentItemId', name: 'componentItemId', width: 1,hide:1 },
				  { display: 'componentSequenceId', name: 'componentSequenceId', width: 1,hide:1 },
				  { display: '编码', name: 'code', width: 180 },
                  { display: '原材料名称', name: 'name', width: 200 },
                  { display: '规格型号', name: 'spec', width: 260 },
                  { display: '单位', name: 'junit', width: 200},
                  { display: '用量', name: 'totalQty', width: 200},
                  { display: '状态列', name: 'processCode', width: 1,hide:1},
                  { display: '替代物料',width: 150,
                	        render: function (record, rowindex, value, column) {
                	        	var str = record.componentSequenceId;
                		  	   return '<input type="button" value="查看所有替代物料" onclick="ItemWindow(\''+str+'\')"/>';
                		  }
						},
                  ],
                  enabledEdit: true,
                  usePager: true,pageSize:1000,pageSizeOptions:[1000],
                  data : griddata,enabledSort:false,
                  width: "100%", height:"98%", checkbox: true,
//                   toolbar: { items: [
//                                      { text: '添加物料', click: ItemWindow, icon: 'add' },
//                                      { line: true },
//                                      { text: '删除', click: deleteRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
//                                      ]
//                                      }
                  });
	
	
	$("#pageloading").hide();
	
	<c:forEach items='${bRawMaterialDOs}' var='item'>
    	var manager = $("#table1").ligerGetGridManager();
    	manager.addRow2({
    		componentItemId : "${item.componentItemId}",
    		componentSequenceId : "${item.componentSequenceId}",
    		code : "${item.code}",
    		name : "${item.name}",
    		spec : "${item.spec}",
    		junit : "${item.junit}",
    		totalQty : "${item.totalQty}",
    		changeNotice : "${item.changeNotice}",
    		processCode : "${item.processCode}",
		});
		</c:forEach>
		
	})

	function ItemWindow(str) {
		getDG().dialog(
				{
					title : '替代物料',
					width : 650,
					height : 350,
					content : 'url:' + sys_context+ '/yd/basic/bomInfo/itemmanager.do?componentSequenceId='+str,//
					lock : true,
					max : true,
					min : true,
					cancelVal : '关闭',
					cancel : true
				}).zindex();
	}


	
</script>

</head>

<body>

<!-- 用于标识提交按钮 -->
 <div class="pageContent" >
    <div class="panel">
         <table class="TableBlock" align="center">
				<tr>
                    <td nowrap>成品名称:</td>
   		                 <td>
   		                <input type="text" id=name name="name" class="inp_width_98p Wdate required" disabled="disabled" value="${bMaterialsDOs.name}" />
   		                 </td>
   		                 
   		                 <td nowrap>成品编码:</td>
   		                 <td>
   		                	<input type="text" id=code name="code" class="inp_width_98p Wdate required" disabled="disabled"  value="${bMaterialsDOs.code}" />
   		                 </td>
   		           </tr>
   		           
   		           <tr>
                    	<td nowrap>客户简码:</td>
   		                 <td>
   		                <input type="text" id=customerId name="customerId" class="inp_width_98p Wdate required" disabled="disabled" value="${bMaterialsDOs.customerId}" />
   		                 </td>
   		                 
   		                 <td nowrap>规格型号:</td>
   		                 <td>
   		                <input type="text" id=spec name="spec" class="inp_width_98p Wdate required" disabled="disabled"  value="${bMaterialsDOs.spec}" />
   		                 </td>
   		           </tr>
                </table>
                <div id="table1"> </div> 
         </div>
    </div>
</body>
</html>
